﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.ComponentModel.DataAnnotations;
using Languages;
using PTUDW_CNTN2010_F_CDT.Constant;

namespace PTUDW_CNTN2010_F_CDT.Models
{
    public class ChangePasswordModel
    {
        [Required(ErrorMessageResourceName = "CurrentPasswordRequired", ErrorMessageResourceType = typeof(Resources))]
        [MinLength(ConstValue.PasswordMinLength, ErrorMessageResourceName = "CurrentPasswordTooShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.PasswordMaxLength, ErrorMessageResourceName = "CurrentPasswordTooLong", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.Password)]
        [Display(Name = "CurrentPassword", ResourceType = typeof(Resources))]
        public string OldPassword { get; set; }

        [Required(ErrorMessageResourceName = "NewPasswordRequired", ErrorMessageResourceType = typeof(Resources))]
        [MinLength(ConstValue.PasswordMinLength, ErrorMessageResourceName = "NewPasswordTooShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.PasswordMaxLength, ErrorMessageResourceName = "NewPasswordTooLong", ErrorMessageResourceType = typeof(Resources))]
        [RegularExpression(ConstValue.PasswordRegular, ErrorMessageResourceName = "RegularExpress", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.Password)]
        [Display(Name = "NewPassword", ResourceType = typeof(Resources))]
        public string NewPassword { get; set; }

        [Required(ErrorMessageResourceName = "ConfirmNewPasswordRequired", ErrorMessageResourceType = typeof(Resources))]
        [MinLength(ConstValue.PasswordMinLength, ErrorMessageResourceName = "ConfirmNewPasswordTooShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.PasswordMaxLength, ErrorMessageResourceName = "ConfirmNewPasswordTooLong", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.Password)]
        [Compare("NewPassword", ErrorMessageResourceName = "ConfirmPasswordNotMatch", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "ConfirmNewPassword", ResourceType = typeof(Resources))]
        public string ConfirmPassword { get; set; }
    }

    public class LogInModel
    {

        [Required(ErrorMessageResourceName = "UserNameRequired", ErrorMessageResourceType = typeof(Languages.Resources))]
        [MinLength(ConstValue.UserNameMinLength, ErrorMessageResourceName = "UserNameTooShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.UserNameMaxLength, ErrorMessageResourceName = "UserNameTooLong", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "UserName", ResourceType = typeof(Resources))]
        public string UserName { get; set; }

        [Required(ErrorMessageResourceName = "PasswordRequired", ErrorMessageResourceType = typeof(Resources))]
        [MinLength(ConstValue.PasswordMinLength, ErrorMessageResourceName = "PasswordTooShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.PasswordMaxLength, ErrorMessageResourceName = "PasswordTooLong", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.Password)]
        [Display(Name = "Password", ResourceType = typeof(Resources))]
        public string Password { get; set; }

        [Display(Name = "RememberMe", ResourceType = typeof(Resources))]
        public bool RememberMe { get; set; }
    }

    public class RegisterModel
    {

        [Required(ErrorMessageResourceName = "FullNameRequired", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "FullName", ResourceType = typeof(Resources))]
        public string FullName { get; set; }

        [Required(ErrorMessageResourceName = "UserNameRequired", ErrorMessageResourceType = typeof(Resources))]
        [MinLength(ConstValue.UserNameMinLength, ErrorMessageResourceName = "UserNameSoShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.UserNameMaxLength, ErrorMessageResourceName = "UserNameSoLong", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "UserName", ResourceType = typeof(Resources))]
        public string UserName { get; set; }

        [Required(ErrorMessageResourceName = "EmailRequired", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.EmailAddress, ErrorMessageResourceName = "InvalidEmail", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "EmailAddress", ResourceType = typeof(Resources))]
        public string Email { get; set; }


        [Required(ErrorMessageResourceName = "ConfirmEmailRequired", ErrorMessageResourceType = typeof(Resources))]
        [Compare("Email", ErrorMessageResourceName = "ConfirmEmailNotMatch", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.EmailAddress)]
        [Display(Name = "ConfirmEmailAddress", ResourceType = typeof(Resources))]
        public string ConfirmEmail { get; set; }

        [Required(ErrorMessageResourceName = "PasswordRequired", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(ConstValue.PasswordMaxLength, ErrorMessageResourceName = "PasswordTooLong", ErrorMessageResourceType = typeof(Resources))]
        [RegularExpression(ConstValue.PasswordRegular, ErrorMessageResourceName = "RegularExpress", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.Password)]
        [Display(Name = "Password", ResourceType = typeof(Resources))]
        public string Password { get; set; }

        [Required(ErrorMessageResourceName = "ConfirmPasswordRequired", ErrorMessageResourceType = typeof(Resources))]
        [MinLength(6, ErrorMessageResourceName = "ConfirmPasswordTooShort", ErrorMessageResourceType = typeof(Resources))]
        [MaxLength(32, ErrorMessageResourceName = "ConfirmPasswordTooLong", ErrorMessageResourceType = typeof(Resources))]
        [DataType(DataType.Password)]
        [Compare("Password", ErrorMessageResourceName = "ConfirmPasswordNotMatch", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "ConfirmPassword", ResourceType = typeof(Resources))]
        public string ConfirmPassword { get; set; }

        [Required(ErrorMessageResourceName = "SexRequired", ErrorMessageResourceType = typeof(Resources))]
        [Display(Name = "Sex", ResourceType = typeof(Resources))]
        public bool Sex { get; set; }

        [DataType(DataType.PhoneNumber)]
        [Display(Name = "PhoneNumber", ResourceType = typeof(Resources))]
        public string Phone { get; set; }

        [Display(Name = "Address", ResourceType = typeof(Resources))]
        [MaxLength(100, ErrorMessageResourceName = "AddressTooLong", ErrorMessageResourceType = typeof(Resources))]
        public string Address { get; set; }

        [Display(Name = "Province", ResourceType = typeof(Resources))]
        public int ProvinceId { get; set; }

        public virtual Province Province { get; set; }
    }
}